<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-canteens__stockordermx}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table
        v-loading="dataListLoading"
        :data="dataList"
        border
        @selection-change="dataListSelectionChangeHandle"
        style="width: 100%;"
      >
    <el-table-column prop="SupplierName" label="供应商" header-align="center" align="center"></el-table-column>
          <el-table-column type="expand">
      <template slot-scope="props">
                <el-form label-position="top"  style="width: 100%" class="demo-table-expand" inline>
          <el-form-item label="食材名称"  >
          </el-form-item>
          <el-form-item label="单位" >
          </el-form-item>
          <el-form-item label="单价" >
          </el-form-item>
          <el-form-item label="实收数量" >
          </el-form-item>
          <el-form-item label="金额" >
          </el-form-item>
          <el-form-item label="实物图片" >
          </el-form-item>
        </el-form>
        <el-form label-position="top"  style="width: 100%" class="demo-table-expand" inline v-for="(item, index) in props.row.orderMx" :key="index">
          <el-form-item   >
            <span>{{ item.foodName }}</span>
          </el-form-item>
          <el-form-item >
            <span>{{ item.unit }}</span>
          </el-form-item>
          <el-form-item >
            <span>{{ item.unitPrice }}</span>
          </el-form-item>
          <el-form-item  >
            <span>{{ item.arrivalNum }}</span>
          </el-form-item>
          <el-form-item  >
            <span>{{  (item.unitPrice*item.arrivalNum).toFixed(2)  }}</span>
          </el-form-item>
          <el-form-item >
           <el-image
    style="width: 100px; height: 50px"
    :src="item.entityPhoto"
    :preview-src-list="[item.entityPhoto]">
  </el-image>
          </el-form-item>

        </el-form>
      </template>
    </el-table-column>
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total,  prev, pager, next, jumper"
        @current-change="pageChange"
      ></el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>
<script>
/* eslint-disable */

import mixinViewModule from "@/mixins/view-module";
import AddOrUpdate from "./stockordermx-add-or-update";
export default {
  mixins: [mixinViewModule],
  data() {
    return {
      mixinViewModuleOptions: {
        createdIsNeed: false,
        getDataListURL: "/canteens/stockordermx/page",
        getDataListIsPage: true,
        exportURL: "/canteens/stockordermx/export",
        deleteURL: "/canteens/stockordermx",
        deleteIsBatch: true,
        deleteIsBatchKey: "stockOrdermxId"
      },
      dataForm: {
        stockOrdermxId: ""
      }
    };
  },
  activated: function() {
    this.getDetails();
    const { stockOrderId } = this.$route.params;
    this.dataForm.stockOrderId=stockOrderId
  },
  methods: {
        pageChange(e) {
      this.dataForm.page = e;
      this.getDetails();
    },
    getDetails() {
      const { stockOrderId } = this.$route.params;
      this.$http
        .get("canteens/stockordermx/getOrderMx", {
          params: {
            stockOrderId
          }
        })
        .then(({ data: res }) => {
          this.total = res.totalPage;
          this.dataList = res.data.list;
        })
        .catch(() => {});
    }
  },

  components: {
    AddOrUpdate
  }
};
</script>
<style >
.demo-table-expand{
  display:flex;
 
}
.el-form-item{
width: 16.66%
}
.el-image-viewer__close .el-icon-circle-close{
  color: #fff !important
}
</style>